//
//  SLNavigationBar.m
//  SLBSMainKit
//
//  Created by CoderSLZeng on 2017/11/25.
//

#import "SLNavigationBar.h"

@implementation SLNavigationBar

+ (void)setNavBarGlobalBackGroundImage:(UIImage *)globalImage
{
    UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedIn:NSClassFromString(@"SLNavigationController"), nil];
    [navBar setBackgroundImage:globalImage forBarMetrics:UIBarMetricsDefault];
}
    
+ (void)setNavBarGlobalTextColor:(UIColor *)globalTextColor andFontSize:(CGFloat)fontSize
{
    if (globalTextColor == nil) {
        return;
    }
    if (fontSize < 6 || fontSize > 40) {
        fontSize = 16;
    }
    UINavigationBar *navBar = [UINavigationBar appearanceWhenContainedIn:NSClassFromString(@"SLNavigationController"), nil];
    // 设置导航栏颜色
    NSDictionary *titleDic = @{
                               NSForegroundColorAttributeName: globalTextColor,
                               NSFontAttributeName: [UIFont systemFontOfSize:fontSize]
                               };
    [navBar setTitleTextAttributes:titleDic];
}

@end
